<template>

</template>

<script setup lang="ts">
import { reactive, ref, onMounted, computed } from 'vue'
import axios from 'axios';
import type { ComponentSize, FormInstance, FormRules } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'

import {useRoute,useRouter} from 'vue-router'

const route = useRoute();
const router = useRouter();

onMounted(() => {
  getRoleMenuFun()

  getPermissions()

  //调取菜单权限
  getMenuPermissions()
})

const form: any = reactive({
  buttonArray:[]
})

//根据菜单id获取操作权限
const getPermissions=()=>{
  axios.get('http://1.117.93.87:8000/rbacdu/api/Menu/MenuOperationPid', {
    params: {
      pid:3
    }
  }).then(res=>{
    console.log(res);
    
  }).catch(err=>{
    console.log(err);
    
  })    
}

const Data:any=ref([])

//根据菜单id查询按钮功能权限
const getRoleMenuFun=()=>{
  axios.get('http://1.117.93.87:8000/rbacdu/api/RoleMenuFun/RoleMenuFunId', {
    params: {
      menuId:route.query.id
    }
  }).then(res=>{
    console.log(res);
    form.buttonArray=res.data.data
  }).catch(err=>{
    console.log(err);
    
  })    
}

// 调用左侧菜单栏数据
const MenuPermissionsData:any=ref([])
const getMenuPermissions = () => {
  axios.get('http://1.117.93.87:8000/rbacdu/api/Menu/MenuTreeShowByRoleId').then(res=>{
    console.log(res);
    MenuPermissionsData.value=res.data.data
  }).catch(err=>{
    console.log(err);
    
  })    
}


</script>

<style scoped>

</style>